package com.example.demo.mvcConfiger;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class CustomConfigurer implements WebMvcConfigurer {

    @Autowired
    private CustomerInterceptor customerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration interceptorRegistration = registry.addInterceptor(customerInterceptor);
        interceptorRegistration.addPathPatterns("/**");

        interceptorRegistration.excludePathPatterns("/api/admin/login")
                .excludePathPatterns("/test/**");
    }
}
